package guoanmaker.operator.business.controller;

import java.io.IOException;
import java.io.OutputStream;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import guoanmaker.operator.business.model.OperatorPriority;
import guoanmaker.operator.business.model.ReturnResult;
import guoanmaker.operator.business.repository.OperatorPriorityRepository;
import guoanmaker.operator.business.service.OperatorDepartmentService;
import guoanmaker.operator.business.service.OperatorRefuselistService;
import guoanmaker.operator.business.service.OperatorRoleService;
import guoanmaker.operator.business.service.OperatorUserService;
import guoanmaker.operator.helper.common.AjaxJson;
import guoanmaker.operator.helper.common.abstractobj.ApiController;
/**
 * 用户管理（账号管理）
 * @author zj
 *
 * 2017.7.20
 */
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping(ApiController.OPERATOR_USER)
public class OperatorSysUserController {
	
	@Resource
	private AjaxJson ajaxJson;
	
	@Resource
	private  OperatorUserService operatorUserService;
	
	@Resource
	private OperatorRoleService  operatorRoleService;
	
	@Resource
	private OperatorPriorityRepository operatorPriorityRepository;
	
	@Resource
	private OperatorDepartmentService  operatorDepartmentService;
	@Resource
	private OperatorRefuselistService  operatorRefuselistService;
	
	@Autowired  
	private  HttpServletRequest request;
	
	/**
	 * 
	 * @param name
	 * @param userPhone
	 * @param depId
	 * @param roleid
	 * @param username
	 * @return
	 */
	@ApiOperation(value = "新建账号", notes = "新建账号")
	@RequestMapping(value ="insertOperatorUser",method = RequestMethod.POST)
	public  AjaxJson  insertOperatorUser(String name,String userPhone,String depId,String roleid,
			String username){
		ReturnResult returnResult=new ReturnResult();
		try {
			returnResult=operatorUserService.saveOpSysuer(name,userPhone,depId,roleid,username);
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(returnResult);
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData(returnResult);
		}
		return ajaxJson;
		
	}
	
	@ApiOperation(value = "查询账号详情")
	@RequestMapping(value ="queryOperatorUserinfo",method = RequestMethod.POST)
	public  AjaxJson  queryOperatorUserinfo(String id){
		
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorUserService.queryOperatorUserinfo(id));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
		
	}
	
	
	
	
	/**
	 * 
	 * @param ids
	 * @return
	 */
	@ApiOperation(value = "删除账号", notes = "删除单个用户或者多个用户")
	@RequestMapping(value = "deleteForOpuser",method = RequestMethod.POST)
	public  AjaxJson  deleteForOpuser(String ids){
		ReturnResult returnResult=new ReturnResult();
		try {
			returnResult=operatorUserService.deleteForOpuser(ids);
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(returnResult);
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData(returnResult);
		}
		return ajaxJson;
		
	}
	/**
	 * 
	 * @param id
	 * @param name
	 * @param userPhone
	 * @param depId
	 * @param roleid
	 * @param username
	 * 
	 * @return
	 */
	@ApiOperation(value = "修改账号")
	@RequestMapping(value ="editForOpuser",method = RequestMethod.POST)
	public AjaxJson editForOpuser(String id,String name,String userPhone,String depId,String roleid,
			String username,Integer  status){
		ReturnResult returnResult=new ReturnResult();
		try {
			returnResult=operatorUserService.editOpSysuer(id,name,userPhone,depId,roleid,username,status);
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(returnResult);
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData(returnResult);
		}
		
		
		return ajaxJson;
	}
	/**
	 * 
	 * @param id
	 * @return
	 */
	@ApiOperation(value = "冻结账号", notes = "冻结账号")
	@RequestMapping(value ="freezeAcconut",method = RequestMethod.POST)
	public AjaxJson freezeAcconut(String ids){
		ReturnResult returnResult=new ReturnResult();
		try {
			returnResult=operatorUserService.freezeAcconut(ids);
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(returnResult);
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData(returnResult);
		}
		return ajaxJson;
	}
	/**
	 * 
	 * @param id
	 * @return
	 */
	@ApiOperation(value = "激活账号", notes = "激活账号")
	@RequestMapping(value ="activationAcconut",method = RequestMethod.POST)
	public AjaxJson activationAcconut(String ids){
		ReturnResult returnResult=new ReturnResult();
		try {
			returnResult=operatorUserService.activationAcconut(ids);
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(returnResult);
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData(returnResult);
		}
		return ajaxJson;
	}
	@ApiOperation(value = "查询账号列表", notes = "账号设置列表")
	@RequestMapping(value ="operatorUserList",method = RequestMethod.POST)
	public AjaxJson operatorUserList(@RequestParam(value = "page", defaultValue = "0") Integer page,
            @RequestParam(value = "size", defaultValue = "10") Integer size){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorUserService.operatorUserList(page,size));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	@ApiOperation(value = "重置密码")
	@RequestMapping(value ="resetPwd",method = RequestMethod.POST)
	public AjaxJson resetPwd(String id){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorUserService.resetPwd(id));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	
	@ApiOperation(value = "导出账号信息EXCEL",notes="批量账号导出")
	@RequestMapping(value ="exportAccountInfos",method = RequestMethod.POST)
	public @ResponseBody void exportAccountInfos(HttpServletResponse response, String ids) {
		try (OutputStream out = response.getOutputStream(); Workbook wb = operatorUserService.exportAccountInfos(ids);) {
			response.setContentType("application/x-msexcel");
			response.setHeader("Content-Disposition", "attachment;filename=exportBusiness.xls");
			wb.write(out);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	/**
	 * 
	 * @param page
	 * @param size
	 * @param name
	 * @param phone
	 * @param status
	 * @param depId
	 * @param roleId
	 * @return
	 */
	@ApiOperation(value = "多条件查询账号列表")
	@RequestMapping(value ="multiconditionQuery",method = RequestMethod.POST)
	public AjaxJson multiconditionQuery(@RequestParam(value = "page", defaultValue = "0") Integer page,
            @RequestParam(value = "size", defaultValue = "10") Integer size,String name,String phone,Integer status,String depId,String roleId){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorUserService.multiconditionQuery(page,size,name,phone,status,depId,roleId));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
/*****************************************角色列表*****************************************************************/	
	/**
	 * 
	 */
	@ApiOperation(value = "查询角色列表带分页", notes = "角色列表")
	@RequestMapping(value ="operatorRoleListPage",method = RequestMethod.POST)
	public AjaxJson operatorRoleListPage(@RequestParam(value = "page", defaultValue = "0") Integer page,
            @RequestParam(value = "size", defaultValue = "10") Integer size){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorRoleService.operatorRoleListPage(page,size));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	@ApiOperation(value = "查询角色列表", notes = "角色列表")
	@RequestMapping(value ="operatorRoleList",method = RequestMethod.POST)
	public AjaxJson operatorRoleList(){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorRoleService.operatorRoleList());
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	
	/**
	 * 
	 * @param rolename 角色名称
	 * @param pids     以逗号分隔的字符串权限项名称
	 * @return
	 */
	@ApiOperation(value = "新增角色和编辑角色", notes = "新增角色")
	@RequestMapping(value ="addRole",method = RequestMethod.POST)
	public AjaxJson addRole(String id,String  rolename,String pids,String userid,String status){
		ReturnResult returnResult=new ReturnResult();
		try {
			if(status.equals("1")){
				returnResult=operatorRoleService.addRole(rolename,pids,userid);
			}else if(status.equals("2")){
				returnResult=operatorRoleService.editRole(id,rolename,pids,userid);
			}
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(returnResult);
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData(returnResult);
		}
		return ajaxJson;
	}
	

	
/*	@ApiOperation(value = "编辑角色", notes = "编辑角色")
	@RequestMapping(value ="editRole",method = RequestMethod.POST)
	public AjaxJson editRole(String id,String  rolename,String pids,String userid){
		ReturnResult returnResult=new ReturnResult();
		try {
			returnResult=operatorRoleService.editRole(id,rolename,pids,userid);
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(returnResult);
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData(returnResult);
		}
		return ajaxJson;
	}*/
	@ApiOperation(value = "查询角色详细信息")
	@RequestMapping(value ="selectRoleByid",method = RequestMethod.POST)
	public AjaxJson selectRoleByid(String id){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorRoleService.selectRoleByid(id));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	
	
	@ApiOperation(value = "删除角色", notes = "删除角色")
	@RequestMapping(value ="deleteByrole",method = RequestMethod.POST)
	public AjaxJson deleteByrole(String id){
		ReturnResult returnResult=new ReturnResult();
		try {
			returnResult=operatorRoleService.deleteByrole(id);
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(returnResult);
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData(returnResult);
		}
		return ajaxJson;
	}
	
	@ApiOperation(value = "批量删除角色", notes = "可以单个删除也可以批量删除")
	@RequestMapping(value ="deleteByRoles",method = RequestMethod.POST)
	public AjaxJson deleteByRoles(String ids){
		ReturnResult returnResult=new ReturnResult();
		try {
			returnResult=operatorRoleService.deleteByRoles(ids);
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(returnResult);
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData(returnResult);
		}
		return ajaxJson;
	}
	
	
	@ApiOperation(value = "点击使用中获取账号名称", notes = "获取账号名称")
	@RequestMapping(value ="clickByopuserName",method = RequestMethod.POST)
	public AjaxJson clickByopuserName(String id){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorRoleService.clickByopuserName(id));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	
	/************部门设置******************/
	@ApiOperation(value = "新增部门", notes = "新增部门")
	@RequestMapping(value ="addDepartment",method = RequestMethod.POST)
	public AjaxJson addDepartment(String depName,String  userid){
		ReturnResult returnResult=new ReturnResult();
		try {
			returnResult=operatorDepartmentService.addDepartment(depName,userid);
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(returnResult);
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData(returnResult);
		}
		return ajaxJson;
	}
	
	@ApiOperation(value = "批量删除部门", notes = "批量删除部门和单个部门")
	@RequestMapping(value ="deleteDps",method = RequestMethod.POST)
	public AjaxJson deleteDps(String ids){
		ReturnResult returnResult=new ReturnResult();
		try {
			returnResult=operatorDepartmentService.deleteDps(ids);
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(returnResult);
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData(returnResult);
		}
		return ajaxJson;
	}
	
	@ApiOperation(value = "删除单个部门", notes = "删除单个部门")
	@RequestMapping(value ="deleteBydepOne",method = RequestMethod.POST)
	public AjaxJson deleteBydepOne(String id){
		ReturnResult returnResult=new ReturnResult();
		try {
			returnResult=operatorDepartmentService.deleteBydepOne(id);
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(returnResult);
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData(returnResult);
		}
		return ajaxJson;
	}
	
	@ApiOperation(value = "编辑部门", notes = "编辑部门")
	@RequestMapping(value ="editDepartment",method = RequestMethod.POST)
	public AjaxJson editDepartment(String id,String  depname,String userid){
		ReturnResult returnResult=new ReturnResult();
		try {
			returnResult=operatorDepartmentService.editDepartment(id,depname,userid);
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(returnResult);
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData(returnResult);
		}
		return ajaxJson;
	}
	
	@ApiOperation(value = "查询部门列表加分页", notes = "查询部门列表加分页")
	@RequestMapping(value = "queryAllDepsPage",method = RequestMethod.POST)
	public AjaxJson queryAllDepsPage(@RequestParam(value = "page", defaultValue = "0") Integer page,
            @RequestParam(value = "size", defaultValue = "10") Integer size){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorDepartmentService.queryAllDepsPage(page,size));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	@ApiOperation(value = "查询部门列表", notes = "查询部门列表加分页")
	@RequestMapping(value = "queryAllDeps",method = RequestMethod.POST)
	public AjaxJson queryAllDeps(){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorDepartmentService.queryAllDeps());
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	
	@ApiOperation(value = "该部门下的账号列表", notes = "该部门下的账号列表")
	@RequestMapping(value ="queryAllDepsforAccounts",method = RequestMethod.POST)
	public AjaxJson queryAllDepsforAccounts(String id){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorDepartmentService.queryAllDepsforAccounts(id));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	
/************审核原因类别**************/	
	
	@ApiOperation(value = "查询审核原因列表加分页", notes = "查询审核原因列表加分页")
	@RequestMapping(value ="queryAllrefuseListpage",method = RequestMethod.POST)
	public AjaxJson queryAllrefuseListpage(@RequestParam(value = "page", defaultValue = "0") Integer page,
            @RequestParam(value = "size", defaultValue = "10") Integer size){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorRefuselistService.queryAllrefuseListpage(page,size));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	@ApiOperation(value = "新增审核原因（针对商户）")
	@RequestMapping(value = "addrefuseList",method = RequestMethod.POST)
	public AjaxJson addrefuseList(String refuseName,String userid){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorRefuselistService.addrefuseList(refuseName,userid));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	
	@ApiOperation(value = "编辑审核原因（针对商户）")
	@RequestMapping(value = "editrefuseList",method = RequestMethod.POST)
	public AjaxJson editrefuseList(String id,String refuseName,String userid){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorRefuselistService.editrefuseList(id,refuseName,userid));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	@ApiOperation(value = "批量删除审核原因（针对商户）")
	@RequestMapping(value = "deleterefuseForList",method = RequestMethod.POST)
	public AjaxJson deleterefuseForList(String ids){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorRefuselistService.deleterefuseList(ids));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
   
	@ApiOperation(value = "单个删除审核原因（针对商户）")
	@RequestMapping(value = "deleteRefuseList",method = RequestMethod.POST)
	public AjaxJson deleteRefuseList(String id){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorRefuselistService.deletereUnifuseList(id));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	
	/**
	 * 
	 * @param page
	 * @param size
	 * @param refuseName
	 * @return
	 */
	@ApiOperation(value = "按照除审核原因查询（针对商户）")
	@RequestMapping(value ="queryRefuseNforList",method = RequestMethod.POST)
	public AjaxJson queryRefuseNforList(@RequestParam(value = "page", defaultValue = "0") Integer page,
            @RequestParam(value = "size", defaultValue = "10") Integer size,String refuseName){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorRefuselistService.queryRefuseNforList(page,size,refuseName));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	
	/************系统设置****************/
	
	@ApiOperation(value = "邮件服务配置信息")
	@RequestMapping(value ="querymailConfig",method = RequestMethod.POST)
	public AjaxJson querymailConfig(){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorUserService.querymailConfig());
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	/**
	 * 
	 * @param id
	 * @param account
	 * @param password
	 * @param recevieAdress
	 * @param issiueAdress
	 * @param status
	 * @return
	 */
	@ApiOperation(value = "修改邮件配置信息")
	@RequestMapping(value ="editmailConfig",method = RequestMethod.POST)
	public AjaxJson editmailConfig(String  id,String account,String password,String recevieAdress,String issiueAdress,Integer status){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorUserService.editmailConfig(id,account,password,recevieAdress,issiueAdress,status));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	/**
	 * 
	 * @param name
	 * @param email
	 * @param userid
	 * @return
	 */
	@ApiOperation(value = "个人账号设置")
	@RequestMapping(value ="personalAccountSetting",method = RequestMethod.POST)
	public AjaxJson personalAccountSetting(String name,String email,String userid){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorUserService.personalAccountSetting(name,email,userid));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	@ApiOperation(value = "个人账号设置信息回显")
	@RequestMapping(value ="personalAccountSettinginfo",method = RequestMethod.POST)
	public AjaxJson personalAccountSettinginfo(String userid){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorUserService.personalAccountSettinginfo(userid));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	
	@ApiOperation(value = "个人账号设置修改密码")
	@RequestMapping(value ="personalAccountSettingPwd",method = RequestMethod.POST)
	public AjaxJson personalAccountSettingPwd(String password,String userid){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorUserService.personalAccountSettingPwd(password,userid));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	
	
	@RequestMapping(value ="addmail",method = RequestMethod.POST)
	public AjaxJson addmail(String account,String password,String recevieAdress,String issiueAdress,String status){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorUserService.addmail(account,password,recevieAdress,issiueAdress,status));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	@ApiOperation(value = "查看邮件服务器密码记录")
	@RequestMapping(value ="querymailpwd",method = RequestMethod.POST)
	public AjaxJson querymailpwd(String userid){
		try {
			ajaxJson.setSuccess(true).setStatus(200).setMsg("操作成功").setData(operatorUserService.querymailpwd(userid));
		} catch (Exception e) {
			ajaxJson.setSuccess(false).setStatus(500).setMsg("操作失败").setData("error");
		}
		return ajaxJson;
	}
	
	
      
}
